<?php

/**
 * @author shuang
 * @date 2016-12-20 16:06:33
 */
use yii\helpers\ArrayHelper;
use frontend\models\WB_UserPayRecord;
use yii\helpers\Url;

$this->registerCssFile("/css/validate.css");
$this->registerCssFile("/js/ui-dialog.css");
$this->registerCssFile("/css/jquery.datatables.css");
$this->registerJsFile("/js/dialog-plus-min.js", [\yii\web\JqueryAsset::className(), "depends" => "\yii\web\JqueryAsset"]);
$this->registerJsFile("/js/jquery.zclip.min.js", [\yii\web\JqueryAsset::className(), "depends" => "\yii\web\JqueryAsset"]);
echo $this->render("//layouts/breadcrumb", ["url" => Url::toRoute(["account/payout"]), "title" => "支出明细"]);
?>
<div class="container-fluid">
    <div class="row-fluid">
        <div class="span12 well ibox float-e-margins">
            <div class="ibox-title">交易明细 </div>
            <div class="well-content ibox-content">
                <form class="search" action="" method="get">
                    <div class="control-group">
                        <div class="controls">
                            <input class="span2" id="begin_at" value="<?php echo $begin_at;?>" name="begin_at" placeholder="输入开始日期" style="float:left;margin:0 10px;" type="text">
                            <input class="span2" id="end_at" value="<?php echo $end_at;?>" name="end_at" placeholder="输入结束日期" style="float:left;" type="text">
                            <select id="statusType" class="span1 left" name="statusType" style="float:left;margin:0 10px;">
                                <option value="0" <?php echo $statusType == 0 ? "selected" : null; ?>>全部</option>
                                <option value="1" <?php echo $statusType == 1 ? "selected" : null; ?>>充值</option>
                                <option value="2" <?php echo $statusType == 2 ? "selected" : null; ?>>付款</option>
                                <option value="3" <?php echo $statusType == 3 ? "selected" : null; ?>>退款</option>
                            </select>                      
                            <button type="submit" id="search" class="left btn btn-success" style="padding:5px 12px;">查询</button>
                        </div>
                    </div>
                </form>
                <div class="table-responsive">
                    <div id="table1_wrapper" class="dataTables_wrapper no-footer">
                        <table id="table1" class="table dataTable no-footer" role="grid" aria-describedby="table1_info">
                            <thead>
                                <tr role="row">
                                    <th style="width: 10%">序号</th>
                                     <th style="width: 50%">名称</th>
                                    <th style="width: 10%">金额</th>
                                    <th style="width: 10%">类型</th>
                                    <th style="width: 10%;text-align: left;">时间</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php foreach ($data as $item): ?>
                                    <tr class="gradeA odd" role="row">
                                        <td><?php echo $item["id"]; ?></td>
                                        <td><?php echo ArrayHelper::getValue($item, "description"); ?></td>
                                        <td><?php echo ArrayHelper::getValue($item, "amount"); ?>元</td>
                                        <?php if(in_array($item["class_type"], [1,5,8])):?>
                                        <td><span class="label label-info">充值</span></td>
                                        <?php endif;?>
                                        <?php if(in_array($item["class_type"], [4, 6, 7,9])):?>
                                        <td><span class="label label-success">付款</span></td>
                                        <?php endif;?>
                                        <?php if(in_array($item["class_type"], [2, 3])):?>
                                        <td><span class="label label-important">退款</span></td>
                                        <?php endif;?>
                                        <td class="center"><?php echo date("Y-m-d H:i:s", ArrayHelper::getValue($item, "created_at")); ?></td>
                                    </tr>
                                <?php endforeach; ?>
                            </tbody>
                        </table>
                    </div>
                    <div class="pagination" style="float:right;">
                        <?php
                        echo
                        \yii\widgets\LinkPager::widget([
                            'pagination' => $pager,
                            'nextPageLabel' => '下一页',
                            'prevPageLabel' => '上一页',
                        ]);
                        ?>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<?php $this->beginBlock('trade-detail') ?>
jeDate({
    dateCell: '#begin_at',
    format: 'YYYY-MM-DD',
    festival: true,
    maxDate: '2099-06-16', //最大日期
    isTime: true
});
jeDate({
    dateCell: '#end_at',
    format: 'YYYY-MM-DD',
    festival: true,
    maxDate: '2099-06-16', //最大日期
    isTime: true
});
<?php $this->endBlock() ?>  
<?php $this->registerJs($this->blocks['trade-detail'], \yii\web\View::POS_END); ?>